/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef COULOMETER_H
#define COULOMETER_H

/* Includes ------------------------------------------------------------------*/
#include "usart.h"

/* Exported constants --------------------------------------------------------*/
#define CoulometerData_Length 15
#define Coulometer_DataPushRequestLength 8

#define Battary_FullVoltage_100 1410
#define Battart_EmptyVoltage_100 1080 
#define Pacentage_PiceVoltage_100 3.3f

/* Exported macros -----------------------------------------------------------*/
#define Coulometer_FucGroundInit \
{ \
	&USART5_Coulometer_IT_Init, \
	&Coulometer_Depkg, \
	&Coulometer_DataRequest, \
}

/* Exported types ------------------------------------------------------------*/
#pragma anon_unions
#pragma pack(1)
typedef struct
{
	union
	{
		uint8_t CoulometerRecive[CoulometerData_Length];
		struct
		{
			uint16_t Header;
		  	uint8_t ModeNumber;
			uint8_t VoltagePercentage;
			uint8_t Voltage_Upper;
			uint8_t Voltage_Downer;
			uint8_t Current_Upper;
			uint8_t Current_Downer;
			uint8_t RatedCapacity_Upper;
			uint8_t RatedCapacity_Downer;
			uint8_t Temperature_Upper;
			uint8_t Temperature_Downer;
			uint8_t CurrentDirection;
			uint8_t ModuleAddress;
			uint8_t SumCheck;
		};
	};
}CoulometerReciver_t;
#pragma pack()

typedef struct
{
	uint8_t Depkg_VoltagePercentage;
	float Depkg_Voltage;
	float Depkg_Current;
	uint16_t Depkg_RatedCapacity;
	float Depkg_Temperature;
	uint8_t Depkg_CurrentDirection;
}CoulometerDepkg_t;

typedef struct
{
	void(*USART5_Coulometer_IT_Init)(void);
	void(*Coulometer_Depkg)(CoulometerReciver_t CR);
	void(*Coulometer_DataRequest)(void);
}Coulometer_Fuc;

/* Exported variables --------------------------------------------------------*/
extern Coulometer_Fuc Coulometer_Functions;
extern CoulometerReciver_t CoulometerReceiver;
extern CoulometerDepkg_t CoulometerDepkg;
extern uint8_t Coulometer_DataPushRequest[8];

/* End -----------------------------------------------------------------------*/
#endif

